import Vue from 'vue'
import Router from 'vue-router'
import page403 from '@/views/page403'
import lookboard from '@/views/systemMange/lookboard/index.vue'
import lookboard2 from '@/views/systemMange/lookboard/hideHeader.vue'
import newFileBoard from '@/views/systemMange/lookboard/newFileBoard.vue'
import system_board from '@/views/systemMange/lookboard/system_board.vue'
import page404 from '@/views/page404'
import page500 from '@/views/page500'
import layout from '@/views/layout/Layout'
import login from '@/views/login/index'
import BigScreen from '@/views/BigScreen/index'

Vue.use(Router)

export const constantRouterMap = [
  {
    path: '/BigScreen',
    component: BigScreen,
    props: (route) => ({ query: route.query.code })
    },
  {
    path: '/lookboard',
    component: newFileBoard,
    props: (route) => ({ query: route.query.code })
  },
  // {
  //   path: '/lookboard',
  //   component: lookboard,
  //   props: (route) => ({ query: route.query.code })
  // },

  {
    path: '/board',
    component: lookboard2,
    props: (route) => ({ query: route.query.code })
  },

  {
    path: '/page403',
    component: page403
  },
  {
    path: '/page404',
    component: page404
  },
  {
    path: '/page500',
    component: page500
  },
  {
    path: '/login',
    component: login,
    props: (route) => ({ query: route.query.mode }),
  },
  {
    path: '/',
    component: login
  },
  {
    path: '',
    component: login
  },
  {
    path: '/allLookBoard',
    component: layout,
    meta: { onlyParent:true,title: '工装看板',type:"2", icon: 'fa fa-tasks',image:require('@/assets/images/lookboard.png'),iconFont: 'icon-kanban' },
    children:[{
      path: 'index',
      name: 'index',
      component: system_board,
      meta: { title: '工装看板', icon: 'fa fa-link'}
    }]
  },
  {
    path: '/gzManage',
    component: layout,
    meta: { title: '工装管理',type:"2",permission:"gz:index", icon: 'fa fa-tasks',image:require('@/assets/images/gzm.png'),iconFont: 'icon-gongju' },
    children: [
      {
        path: 'repairLog',
        name: 'repairLog',
        component: () => import('@/views/gzManage/repairLog/index'),
        meta: { title: '维保记录',permission:"wb:gz", icon: 'fa fa-link',image:require('@/assets/images/record.png'),iconFont: 'icon-xian_jilu' }
      },
      {
        path: 'gzRepair',
        name: 'gzRepair',
        component: () => import('@/views/gzManage/gzRepair/index'),
        meta: { title: '工装维保',permission:"wb:gz", icon: 'fa fa-link',image:require('@/assets/images/gzWb.png'),iconFont: 'icon-weibao' }
      },
      {
        path: 'gzSpecialCon',
        name: 'gzSpecialCon',
        component: () => import('@/views/gzManage/gzSpecialCon/index'),
        meta: { title: '维保特况',permission:"tk:gz", icon: 'fa fa-link',image:require('@/assets/images/tk.png'),iconFont: 'icon-teshujiancha' }
      },
      {
        path: 'index',
        name: 'index',
        component: () => import('@/views/gzManage/manage/index'),
        meta: { title: '工装管理',permission:"gz:gz", icon: 'fa fa-users',image:require('@/assets/images/gz.png'),iconFont: 'icon-guanli' }
      },
      {
        path: 'gzTake',
        name: 'gzTake',
        component: () => import('@/views/gzManage/gzTake/index'),
        meta: { title: '工装领用',permission:"take:gz", icon: 'fa fa-users',image:require('@/assets/images/lingyong.png'),iconFont: 'icon-wuzilingyong' }
      },
      {
        path: 'gzAccount',
        name: 'gzAccount',
        component: () => import('@/views/gzManage/gzAccount/index'),
        meta: { title: '工装台账',permission:"account:gz", icon: 'fa fa-desktop',image:require('@/assets/images/excel.png'),iconFont: 'icon-taizhang' }
      }
    ]
  },
  {
    path: '/deManage',
    component: layout,
    meta: { title: '设备管理',type:"3",permission:"device:index", icon: 'fa fa-truck' ,image:require('@/assets/images/devicem.png'),iconFont: 'icon-shebei'},
    children: [
      {
        path: 'deRepair',
        name: 'gzRepair',
        component: () => import('@/views/device/deRepair/index'),
        meta: { title: '设备维保',permission:"wb:device", icon: 'fa fa-link',image:require('@/assets/images/gzWb.png'),iconFont: 'icon-weibao' }
      },
      {
        path: 'manage',
        name: 'manage',
        component: () => import('@/views/device/manage/index'),
        meta: { title: '设备管理',permission:"device:device", icon: 'fa fa-users' ,image:require('@/assets/images/device.png'),iconFont: 'icon-guanli'}
      },
      {
        path: 'importByDate',
        name: 'importByDate',
        component: () => import('@/views/device/importByDate/index'),
        meta: { title: '添加保养计划',permission:"plan:device", icon: 'fa fa-calendar-plus-o',image:require('@/assets/images/planjh.png'),iconFont: 'icon-baoyang'}
      },
      {
        path: 'deAccount',
        name: 'deAccount',
        component: () => import('@/views/device/deAccount/index'),
        meta: { title: '设备台账',permission:"account:device", icon: 'fa fa-desktop',image:require('@/assets/images/excel.png'),iconFont: 'icon-taizhang' }
      }
    ]
  },
  {
    path: '/systemManage',
    component: layout,
    meta: { title: '系统管理',permission:"setting:index", icon: 'fa fa-cog',image:require('@/assets/images/systemManage.png'),iconFont: 'icon-guanli1' },
    children: [
      {
        path: 'userManage',
        name: 'userManage',
        component: () => import('@/views/systemMange/user/index'),
        meta: { title: '用户管理',permission:"user:setting", icon: 'fa fa-user-o',image:require('@/assets/images/user.png'),iconFont: 'icon-yonghu' }
      },
      {
        path: 'deptManage',
        name: 'deptManage',
        component: () => import('@/views/systemMange/dept/index'),
        meta: { title: '部门管理',permission:"dept:setting", icon: 'fa fa-building',image:require('@/assets/images/department.png'),iconFont: 'icon-bumen' }
      },
      {
        path: 'gw',
        name: 'gw',
        component: () => import('@/views/systemMange/gongqu/index'),
        meta: { title: '工段编码',permission:"gd:setting", icon: 'fa fa-sort-numeric-desc',image:require('@/assets/images/plan.png'),iconFont: 'icon-bianma' }
      },
      {
        path: 'kw',
        name: 'kw',
        component: () => import('@/views/systemMange/kuwwei/index'),
        meta: { title: '库位管理',permission:"kuwei:setting", icon: 'fa fa-table',image:require('@/assets/images/warehouse.png'),iconFont: 'icon-kuweiguanli'  }
      },
      {
        path: 'bf',
        name: 'bf',
        component: () => import('@/views/systemMange/baofei/index'),
        meta: { title: '报废管理',permission:"dump:setting", icon: 'fa fa-chain-broken',image:require('@/assets/images/Junk.png'),iconFont: 'icon-baofeiguanli' }
      },
      {
        path: 'permission',
        name: 'permission',
        component: () => import('@/views/systemMange/permission/index'),
        meta: { title: '权限管理',permission:"qx:setting", icon: 'fa fa-chain-broken',image:require('@/assets/images/quanxian.png'),iconFont: 'icon-quanxian' }
      },
      {
        path: 'dbStore',
        name: 'dbStore',
        component: () => import('@/views/systemMange/dbStore/index'),
        meta: { title: '数据备份',permission:"db:setting", icon: 'fa fa-chain-broken',image:require('@/assets/images/dataStore.png'),iconFont: 'icon-beifen' }
      },
      {
        path: 'picture',
        name: 'picture',
        component: () => import('@/views/systemMange/picture/index'),
        meta: { title: '图片管理',image:require('@/assets/images/pictureIcon.png'),iconFont: 'icon-tupian' }
      }
    ]
  },
]
export default new Router({
  scrollBehavior: () => ({y: 0}),
  routes: constantRouterMap
})

export const asyncRouterMap = [
  { path: '*', redirect: '/404', hidden: true }
]
